namespace CavemanTools.Sql
{
	/// <summary>
	/// Result of a scalar query.
	/// </summary>
	/// <typeparam name="T">Type of value</typeparam>
	public struct ScalarResult<T>
	{
		/// <summary>
		/// Sets the value of result
		/// </summary>
		/// <param name="value">Type</param>
		public ScalarResult(T value)
		{
			_hasValue = true;
			_value = value;
		}

		private T _value;
		
		/// <summary>
		/// GEts the value of result
		/// </summary>
		public T Value
		{
			get { return _value; }			
		}

		private bool _hasValue;
		
		/// <summary>
		/// Returns true if the result is not empty
		/// </summary>
		public bool HasValue
		{
			get { return _hasValue; }			
		}
	}
}